/*
Package factories
@Author   : Uyynot
@Email    : uyynot@qq.com
@Time     : 2024/4/25 17:30
@File     : user_factory.go
@Project  : gohub
@Desc     :
*/
package factories

import (
	"github.com/bxcodec/faker/v3"
	"gohub/app/models/user"
	"gohub/pkg/helpers"
)

// MakeUsers
// @Description: 生成用户
// @param times
// @return []user.User
func MakeUsers(times int) []user.User {
	var objs []user.User

	//设置faker唯一值
	faker.SetGenerateUniqueValues(true)

	//生成times条用户数据
	for i := 0; i < times; i++ {
		model := user.User{
			Name:     faker.Username(),
			Email:    faker.Email(),
			Phone:    helpers.RandomNumber(11),
			Password: "$2a$14$oPzVkIdwJ8KqY0erYAYQxOuAAlbI/sFIsH0C0R4MPc.3JbWWSuaUe",
		}
		objs = append(objs, model)
	}
	return objs
}
